home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 August: Tool Chest / Dev.CD Aug 98 TC.toast / Tool Chest / Testing & Debugging / Mac OS Development Toolkit / Automation Essentials 2.3.0 / Host Automation Folder / VU External Tool libs / MathTool.vulib < prev    next >
Encoding:
Text File  |  1998-03-19  |  3.6 KB  |  94 lines  |  [TEXT/MPS ]

  1. #
  2. #    File:        MathTool.vulib
  3. #    
  4. #    Written by:    David Gaxiola
  5. #
  6. #    Contents:    MathTool interface.
  7. #
  8. #    Copyright © 1992-1997 Apple Computer, Inc.  All rights reserved.
  9. #
  10. #    Change history (most recent first):
  11. #    Version      Date        Who        Comments
  12. #    =======    ========    ===        ===============
  13. #    2.2.0    02/12/97    JAS        Added 'vers' resources to library.
  14. #                                These should always match tool version when tool is revved.
  15. #            01/16/97    JAS        Changed return types to the appropriate kinds.
  16. #                                If there's an error, MathTool returns an empty
  17. #                                string in the returnValue.
  18. #            10/24/96    JAS        Changed all return types to 'undefined'.
  19. #            10/30/92    PRT        Add declarations for required tool services.
  20. #                                Make parameters 'undefined' to allow either numbers
  21. #                                or strings.
  22. #            8/11/92        DGG        Created.
  23. #
  24. #    Note:        The file “MathTool User Guide” explains the services that MathTool
  25. #                provides, and lists what each service takes as arguments and returns as results.
  26. #                (For the services common to all Virtual User external tools, see the Virtual
  27. #                User Language Reference manual.) 
  28. #                The file "MathTool ReadMe" contains last minute info on MathTool.
  29. #                The script file “MathToolExample.vu" provides a few simple examples
  30. #                of using MathTool.
  31. #
  32.  
  33. task DefineMathGlobals()
  34. begin
  35.     global gPi := "3.141592654";
  36.     global gE := "2.718281828";
  37. end;
  38.  
  39. tool MathTool s:'VUmt'    # signature of MathTool
  40. begin
  41.  
  42.     # Services specific to MathTool:
  43.     
  44.     ## floating point operations:
  45.     Service "fplus"('string', 'string') return 'string';        # floating point addition
  46.     Service "fminus"('string', 'string') return 'string';        # floating point subtraction
  47.     Service "ftimes"('string', 'string') return 'string';        # floating point multiplication
  48.     Service "fdivide"('string', 'string') return 'string';        # floating point division
  49.     Service "fcompare"('string', 'string') return 'integer';    # floating point compare
  50.     
  51.     ## trigonometric operations:
  52.     Service "sin"('string') return 'string';    # sine function
  53.     Service "cos"('string') return 'string';    # cosine function
  54.     Service "tan"('string') return 'string';    # tangent function
  55.     Service "asin"('string') return 'string';    # arcsine function
  56.     Service "acos"('string') return 'string';    # arcosine function
  57.     Service "atan"('string') return 'string';    # arctangent function
  58.     
  59.     ## exponetiation (power) operations:
  60.     Service "sqrt"('string') return 'string';                # square root
  61.     Service "power"('string', 'string') return 'string';    # exponetiation (a^b)
  62.     
  63.     ## logarithmic operations
  64.     Service "ln"('string') return 'string';        # natural logarithm (base e)
  65.     
  66. ### !!!!!!!!!!WARNING!!!!!!!!!!
  67. ### The following services are included for compatibility ONLY.
  68. ### Please use VU to perform integer math as these services WILL go away in
  69. ### the future.
  70. #
  71. #   These services work on MC680x0 'LONG' integers.  You can pass them either short integers
  72. #    (ones between -32767 and 32767) or long integers enclosed in quotations.
  73. #
  74.     Service "lplus"('integer', 'integer') return 'integer';
  75.     Service "lminus"('integer', 'integer') return 'integer';
  76.     Service "ltimes"('integer', 'integer') return 'integer';
  77.     Service "ldivide"('integer', 'integer') return 'integer';
  78.     Service "lcompare"('integer', 'integer') return 'integer';
  79.     Service "lmod"('integer', 'integer') return 'integer';
  80.     
  81. ### !!!!!!!!!!!!!!!!!!!!!!!!!!!    
  82.     
  83.     # Services common to all Virtual User external tools:
  84.     
  85.     Service "Initialize"( 'string' );        # pass TRUE for target, FALSE for host
  86.     Service "Cancel"( 'string' );
  87.     Service "GetToolServices"() return 'list';
  88.     Service "GetToolVersion"() return 'list';
  89.     Service "Poll"( 'string' ) return 'string';
  90.     Service "ServiceSupported"( 'string' ) return 'symbol';
  91.     Service "Quit"();
  92.  
  93. end;
  94.